<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Xppass Administrator's Control Panel</title>
<LINK href="<?php echo $www_site_url?>/public/yav-style.css" type=text/css rel=stylesheet>
<link href="<?php echo $www_site_url?>/public/style/boxy.css" type="text/css" rel="stylesheet">
<!-- <script src="<?php echo $www_site_url?>/public/js/common.js" type="text/javascript"></script> -->
<script src="<?php echo $www_site_url?>/public/js/jquery-1.8.3.min.js" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo $www_site_url?>/public/js/jquery.boxy.js"></script>

<script type="text/javascript">
function addMouseEvent(obj){
	var checkbox,atr,ath,i;
	atr=obj.getElementsByTagName("tr");
	for(i=0;i<atr.length;i++){
		atr[i].onclick=function(){
			ath=this.getElementsByTagName("th");
			checkbox=this.getElementsByTagName("input")[0];
			if(!ath.length && checkbox.getAttribute("type")=="checkbox"){
				if(this.className!="currenttr"){
					this.className="currenttr";
					checkbox.checked=true;
				}else{
					this.className="";
					checkbox.checked=false;
				}
			}
		}
	}
}
</script>
</head>

<body><div id="append"></div>
<div id="msg" style="color:red;text-align:center"></div>


	<div class="container">

		<h3><?php echo $corp['c_title']?> <?php if(isset($brand['b_name'])) echo splitx($brand['b_name']);?> <?php echo lang('store_list')?>:<?php echo lang('store_total')?>:<?php echo $total?></h3>

		<div class="mainbox">
				<form action="<?php echo $www_site_url?>/admin.php" onsubmit="return confirm('<?php echo lang('domain_delete_comfirm')?>');" method="post">
				<input type="hidden" name="action" value="corporation">
				<input type="hidden" name="op" value="delstore">
				<table class="datalist fixwidth" onmouseover="addMouseEvent(this);" >

					<tr>
						<th><input type="checkbox" name="chkall" id="chkall" onclick="checkall('delete[]')" class="checkbox" /><label for="chkall"><?php echo lang('delete')?></label></th>
						<th>ID</th>
						<th><?php echo lang('cs_abbr')?></th>
						<th><?php echo lang('cs_name')?></th>
						<th><?php echo lang('cs_address')?></th>
						<th>顺序</th>
						<th><?php echo lang('assignment')?></th>
						<th><?php echo lang('edit')?></th>
						<th><?php echo lang('store_status')?></th>
					</tr>
						<?php if(isset($stores) && is_array($stores)){
							foreach ($stores as $v){?>
						<tr>
							<td class="option"><input type="checkbox" name="delete[]" value="<?php echo $v['cs_id']?>" class="checkbox" /></td>
							<td><?php echo $v['cs_id']?></td>
							<td><?php echo $v['cs_abbr']?></td>
							<td><strong><?php echo splitx($v['cs_name']);?></strong></td>
							<td><?php echo splitx($v['cs_address']);?></td>
							<td><?php echo $v['cs_order']?></td>
							<td><a href="/admin.php/assignment/defaults/cs_id/<?php echo $v['cs_id']?>"><?php echo lang('assignment')?></a></td>
							<td><a href="/admin.php/corporation/editstore/cs_id/<?php echo $v['cs_id']?>"><?php echo lang('edit')?></a></td>
							<td><a href="javascript:void(0);" class="setSwitch" storeid="<?php echo $v['cs_id']?>" setvalue="<?php echo ($v['disabled'] == 1) ? 0 : 1;?>"><?php echo ($v['disabled'] == 1) ? '<span style="color:red">关闭</span>' : '<span style="color:green">开启</span>'?></a></td>
						</tr>

						<?php }
						}?>
										<tr class="nobg">
						<td><input type="submit" value="<?php echo lang('submit')?>" class="button" />
						 <input type="button" value="<?php echo lang('goback')?>" onclick="history.go(-1);" class="button" />
						 </td>
					</tr>
				</table>

				</form>
					</div>

	</div>

</body>
<script type="text/javascript">
$(document).ready(function(){
	$('.setSwitch').click(function(){
		var storeId = $(this).attr('storeid');
		var setValue = $(this).attr('setvalue');
		Boxy.confirm('确定执行该操作吗？', function(){
			$.ajax({
				type: 'get',
				url: '/admin.php/corporation/store/storeId/'+storeId+'/setValue/'+setValue+'/option/storeSwitch',
				//data: {"storeId": storeId, "setValue": setValue, "option": "storeSwitch"},
				success: function(r){
					window.location.reload(true);
				}
			});
		});
	});
	
});

</script>
</html>